package com.vgooo.util;

public class VedioUrlUtils {
	
	
	private  final static String s1 = "<html><body leftmargin=0 topmargin=0 scroll=no> <embed width=100% height=50% fullscreen=yes src=\"" ;
	private  final static  String s2 = "\"></body></html>" ;
	private  final static  String s3 = "<html><body leftmargin=0 topmargin=0 scroll=no> <embed width=100% height=50% fullscreen=yes src=\"http://player.youku.com/player.php/sid/" ;
	private  final static  String s4 = "/v.swf\"></body></html>" ;
	
//	private  final static String s1 = "<html><body leftmargin=0 topmargin=0 scroll=no> <embed width=100% height=100% fullscreen=no src=\"" ;
//	private  final static  String s2 = "\"></body></html>" ;
//	private  final static  String s3 = "<html><body leftmargin=0 topmargin=0 scroll=no> <embed width=100% height=50% fullscreen=no src=\"http://static.youku.com/v1.0.0292/v/swf/loader.swf?VideoIDS=" ;
//	private  final static  String s4 = "\"></body></html>" ;
	
	
	//web.loadData("<html><body leftmargin=0 topmargin=0 scroll=no> <embed width=100% height=100% fullscreen=no src=\"http://static.youku.com/v1.0.0292/v/swf/loader.swf?VideoIDS=XNDg2NzkzMzk2\"></body></html>", "text/html", "UTF-8");
	public static String getData(String url){
		String res = "<html><body leftmargin=0 topmargin=0 scroll=no> <embed width=100% height=100% fullscreen=yes src=\"http://player.youku.com/player.php/sid/XNDg2NzkzMzk2/v.swf\"></body></html>";
		if(url.endsWith(".html")){
			return s3+getVedioId(url)+s4;
//			return s3+"XNDg2NzkzMzk2"+s4;
		}else if(url.endsWith(".swf")){
			return s1+url+s2 ;
		}
//		return null ;
		return res ;
	}
	
	public static String getVedioId(String url){
		int start = url.lastIndexOf("_")+1;
		int end = url.lastIndexOf(".") ;
		return url.subSequence(start, end).toString() ;
	}
}
